package ui.util;

import javax.swing.JOptionPane;

import ui.LoadingMessagePanel;
import ui.MainJFrame;

import exceptions.DatabaseErrorException;
import appControll.AppController;

public class DBReleaseThread extends Thread{
	public void run(){
		MainJFrame.getUniqueInstance().setContentPane(new LoadingMessagePanel("Deconnexion en cours..."));
		MainJFrame.getUniqueInstance().displayProgress();
		try {
			AppController.getUniqueInstance().logout();
			Thread.sleep(1000);
			MainJFrame.getUniqueInstance().hideProgress();
		} catch (Exception e) {
			JOptionPane.showMessageDialog(null, e, "Erreur", JOptionPane.ERROR_MESSAGE);
		}finally{
			System.exit(0);
		}
	}
}
